home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_214 / mandelvroom / src / mand881.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  2KB  |  101 lines

  1. /*
  2.  * MandelVroom 2.0
  3.  *
  4.  * (c) Copyright 1987,1989  Kevin L. Clague, San Jose, CA
  5.  *
  6.  * All rights reserved.
  7.  *
  8.  * Permission is hereby granted to distribute this program's source
  9.  * executable, and documentation for non-comercial purposes, so long as the
  10.  * copyright notices are not removed from the sources, executable or
  11.  * documentation.  This program may not be distributed for a profit without
  12.  * the express written consent of the author Kevin L. Clague.
  13.  *
  14.  * This program is not in the public domain.
  15.  *
  16.  * Fred Fish is expressly granted permission to distribute this program's
  17.  * source and executable as part of the "Fred Fish freely redistributable
  18.  * Amiga software library."
  19.  *
  20.  * Permission is expressly granted for this program and it's source to be
  21.  * distributed as part of the Amicus Amiga software disks, and the
  22.  * First Amiga User Group's Hot Mix disks.
  23.  *
  24.  * contents: this file contains the function that calculates the
  25.  * Mandelbrot/Julia caluclation in 68881 assembly.  This funtion needs
  26.  * work, so that it is all assembly instead of C and assembly.
  27.  */
  28.  
  29. #include "mandp.h"
  30. #include "parms.h"
  31.  
  32. Height_68881( p )
  33.   struct PotentialParms *p;
  34. {
  35.   register LONG k;
  36.   register double *P;
  37.  
  38.   k = p->MaxIteration;
  39.  
  40.   P = (double *) p;
  41.  
  42. #asm
  43. ;       mc68881
  44. ;
  45. ;four     equ   fp1
  46. ;curx     equ   fp2
  47. ;cury     equ   fp3
  48. ;cura     equ   fp4
  49. ;curb     equ   fp5
  50. ;cura2    equ   fp6
  51. ;curb2    equ   fp7
  52. ;
  53. ;
  54. ;  set up modulus
  55.         fmove.d #"$4010000000000000",fp1
  56. ;
  57. ;  move posx and posy into fp4 and fp5
  58. ;  move curx and cury into fp2 and fp3
  59. ;
  60.         fmove.d (a2)+,fp4
  61.         fmove.d (a2)+,fp5
  62.         fmove.d (a2)+,fp2
  63.         fmove.d (a2),fp3
  64. ;
  65.         fmove.x fp4,fp6
  66.         fmove.x fp5,fp7
  67.         fmul.x  fp6,fp6
  68.         fmul.x  fp7,fp7
  69. Loop
  70. ;
  71. ;    curb *= cura;
  72. ;    curb += curb + cury;
  73.         fmul.x  fp4,fp5
  74.         fadd.x  fp5,fp5
  75.         fadd.x  fp3,fp5
  76. ;
  77. ;    cura = cura2 - curb2 + curx
  78.         fsub.x  fp7,fp6
  79.         fadd.x  fp2,fp6
  80. ;
  81. ;    curb2 = curb * curb;
  82.         fmove.x fp5,fp7
  83.         fmul.x  fp5,fp7
  84. ;
  85. ;    cura2 = cura * cura;
  86.         fmove.x fp6,fp4
  87.         fmul.x  fp6,fp6
  88. ;
  89. ;    if (cura2+curb2 > 4.0)
  90. ;      return( k );
  91.         fmove.x fp6,fp0
  92.         fadd.x  fp7,fp0
  93.         fcmp.x  fp1,fp0
  94.         fdbgt   d4,Loop
  95. ;       addq.l  #2,d4
  96. ;
  97. #endasm
  98.      ;
  99.      return( p->MaxIteration - k );
  100. }
  101.